package com.demo.utils;

/**
 * 保存用户信息到Local
 */

import com.demo.dto.UserDTO;
import com.demo.entity.User;

public class UserHolder {
    private static final ThreadLocal<UserDTO> local = new ThreadLocal<>();

    public static void saveUser(UserDTO user){
        local.set(user);
    }

    public static UserDTO getUser(){
        return local.get();
    }

    public static void removeUser(){
        local.remove();
    }
}
